From 46d0cd00e7a77d8d05747f918065ca7806da1062 Mon Sep 17 00:00:00 2001 From: "vhanquez@kneesa.uk.xensource.com" Date: Mon, 9 Jan 2006 11:31:49 +0000 Subject: [PATCH] Fail early without calling dev_request_and_reply if memory cannot be allocated. Signed-off-by: Vincent Hanquez --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c index a9aa6225bd..e175b4e9ea 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c @@ -134,14 +134,17 @@ static ssize_t xenbus_dev_write(struct file *filp, case XS_MKDIR: case XS_RM: case XS_SET_PERMS: + if (u->u.msg.type == XS_TRANSACTION_START) { + trans = kmalloc(sizeof(*trans), GFP_KERNEL); + if (!trans) + return -ENOMEM; + } + reply = xenbus_dev_request_and_reply(&u->u.msg); if (IS_ERR(reply)) return PTR_ERR(reply); if (u->u.msg.type == XS_TRANSACTION_START) { - trans = kmalloc(sizeof(*trans), GFP_KERNEL); - if (!trans) - return -ENOMEM; trans->handle = (struct xenbus_transaction *) simple_strtoul(reply, NULL, 0); list_add(&trans->list, &u->transactions); -- 2.30.2